import request from "./request";

// 获取法务问题列表
export function getCaseTypeList(data?:any) {

  return request({
    url: "/ai-robot/case-type/list",
    isToken: false,
    data
  });
}

// 咨询-提交问题
export function getMessage(message: string, robotId: number) {
  return request({
    url: "/ai-robot/message/add",
    method: "POST",
    data: {
      case_type_id: robotId,
      question: message
    }
  });
}
// 合同-提交问题
export function getContractMessage(
  name: string,
  desc: string,
  robotId: number
) {
  return request({
    url: "/ai-robot/message/contract/add",
    method: "POST",
    data: {
      case_type_id: robotId,
      contract_name: name,
      contract_desc: desc
    }
  });
}
// 综合-提交问题
export function getCommonMessage(question: string) {
  return request({
    url: "/ai-robot/message/common/add",
    method: "POST",
    data: { question }
  });
}

/**
 * 获取热门问题
GET /ai-robot/hot-question/list
接口ID：144265062
接口地址：https://app.apifox.com/project/3935992/apis/api-144265062
 */
export function getHotQuestionList(case_type_id?: number) {
  const data: any = {};
  if (case_type_id) {
    data["case_type_id"] = case_type_id;
  }
  return request({
    url: "/ai-robot/hot-question/list",
    isToken: false,
    data
  });
}
// 获取历史消息列表
export function getHisotryMesssageList(msg_type?: number) {
  return request({
    url: "/ai-robot/history/conversation",
    data: {
      msg_type
    }
  });
}

// 删除历史消息列表
export function delHisotryMesssage(ids: Array<number>) {
  return request({
    url: "/ai-robot/history/conversation",
    method: "DELETE",
    data: {
      ids
    }
  });
}

// 消息列表
export function getConversationMessage(
  id: number,
  pagination: { per_page: number; page: number }
) {
  return request({
    url: "/ai-robot/history/message/list",
    data: {
      case_type_id: id,
      ...pagination
    }
  });
}

// 咨询消息列表
export function getConversationCommonMessage(pagination: {
  per_page: number;
  page: number;
}) {
  return request({
    url: "/ai-robot/history/common/message/list",
    data: pagination
  });
}
